package gdal_grid;

import org.gdal.gdal.Dataset;
import org.gdal.gdal.GridOptions;
import org.gdal.gdal.ProgressCallback;
import org.gdal.gdal.gdal;
import org.gdal.gdalconst.gdalconstConstants;
import org.gdal.ogr.DataSource;
import org.gdal.ogr.Driver;
import org.gdal.ogr.ogr;
import sun.nio.ch.DirectBuffer;

import java.io.*;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.Vector;

public class GridCreateDemo {
    public static void main(String[] args) {
        //String option = "invdist:power=2:smoothing=0.2:radius1=100.0:radius2=0.0:angle=0.0:max_points=2:min_points=2:nodata=0.0,";

        String fileName_shp = "D:\\TestDta\\shape\\cj1z.shp";
        String fileName_tif2 = "D:\\TestDta\\images\\tettt8.tif";
        gdalGrid(fileName_shp, fileName_tif2);
    }

    public static void gdalGrid(String fileShap, String fileTif) {
        Vector<String> vector = new Vector<>();
        vector.add("invdistnn:power=2");
        vector.add("smoothing=0.2");
        GridOptions options = new GridOptions(vector);

        Dataset hDataset = gdal.OpenEx(fileShap);
        gdal.Grid(fileTif, hDataset, options);
    }
}
